import sys
import re

class sample:
	"""t=1187889148995
	pos=-23.5,-10.75,0.0
	id=00:02:2D:21:0F:33;
	#mac, styrke, frq, mode, snr
	00:14:BF:B1:7C:54=-53,2.412E9,3,-96
	00:11:88:5A:31:50=-63,2.462E9,3,-102
	00:14:BF:B1:97:8D=-74,2.442E9,3,-102
	00:16:B6:B7:5D:8F=-68,2.412E9,3,-96
	00:14:BF:B1:97:90=-73,2.427E9,3,-100
	00:16:B6:B7:5D:9B=-79,2.462E9,3,-102
	00:11:88:5A:1B:10=-72,2.437E9,3,-90
	00:14:BF:B1:7C:57=-80,2.447E9,3,-96
	00:11:88:28:5E:E0=-85,2.412E9,3,-96
	00:11:88:5A:B9:60=-90,2.412E9,3,-96
	00:11:88:5A:B9:00=-91,2.437E9,3,-90"""

	def __init__(self, str):
		self.read(str)

	def read(self, str):
		a = str.split(";")

		if (len(a) > 4):
			(self.t, self.pos, self.id) = (a[0:3])
			self.meas=[]
			for m in (a[2:]):
				self.meas.append(meas(str))
		else:
			print "length was %i: %s" % (len(a), str)
		
class meas:
	#mac, styrke, frq, mode, snr
	mac = ''
	strength = '' 
	frq = 0
	mode = 0
	snr = 0

	def __init__(self, str):
		self.read(str)

	def read(self, str):
		"""00:14:BF:B1:7C:54=-53,2.412E9,3,-96"""

		m = re.search(r"^(\S+)=(\S+),(\S+),(\S+)$", str)
		(self.mac, self.strength, self.frq, self.mode, self.snr) = (m.group(0), m.group(1), m.group(2), m.group(3), m.group(4))
		

def read(filename):
	f=open(filename,'r')
	samples = []

	i=1
	for str in f:
		s = sample(str)
		samples.append(s);
		i=i+1
	
	
read(sys.argv[1])

